﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Ajax.Web
{
    public partial class Product_View : Ajax.Tools.BasePage
    {
        protected int Id;//全局变量ID
        protected Ajax.Model.Products model = new Ajax.Model.Products();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["id"] as string, out this.Id))
            {
                this.jsLayMsg(350, 230, "错误提示", "<b>出现错误啦！</b>您要查看的信息参数不正确或不存在。", "back", "Error");
                return;
            }
            Ajax.BLL.Products bll = new Ajax.BLL.Products();
            model = bll.GetModel(this.Id);
            //浏览数+1
            bll.UpdateField(this.Id, "Click=Click+1");
        }

        //取得分类名称
        protected string GetClassTitle(int _classId)
        {
            Ajax.BLL.Channel cbll = new Ajax.BLL.Channel();
            if (!cbll.Exists(_classId))
            {
                return "No Category";
            }
            Ajax.Model.Channel cmodel = cbll.GetModel(_classId);
            return cmodel.Title;
        }
    }
}
